﻿using OVS.Core;
using OVS.Domain;
using OVS.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace OVS.webUI.Controllers
{
    public class PlayersController : Controller
    {
        // GET: Players
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public JsonResult Create(string PlayerName,string PlayerNO)
        {
            try
            {
                Player player = new Player();
                player.PlayerName = PlayerName;
                player.PlayerNO = PlayerNO;
                player.PlayerImage = "Content/img/1 (9).jpg";

                Container.Instance.Resolve<IPlayerService>().Create(player);
            }
            catch
            {
                return Json(0, JsonRequestBehavior.AllowGet);
            }
            return Json(1, JsonRequestBehavior.AllowGet);
        }
    }
}